package com.example.peibei.ui.activity;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.widget.TextView;

import com.dingtao.common.core.WDActivity;
import com.dingtao.common.util.UIUtils;
import com.example.peibei.R;

import butterknife.BindView;
import butterknife.OnClick;

public class AboutUsActivity extends WDActivity {
    @BindView(R.id.tv_version)
    TextView tv_version;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_about_us;
    }

    @Override
    protected void initView() {
        tv_version.setText(getAppVersionName(this));
    }

    /**
     * 返回当前程序版本名称
     */

    public String getAppVersionName(Context context) {
        String versionName = "";
        try {
            PackageManager pm = context.getPackageManager();
            PackageInfo pi = pm.getPackageInfo("com.example.peibei", 0);
            versionName = pi.versionName;
            if (TextUtils.isEmpty(versionName)) {
                return "";
            }

        } catch (Exception e) {
        }
        return versionName;
    }

    @OnClick(R.id.iv_back)
    public void back(){
        finish();
    }

    @OnClick(R.id.rl_check)
    public void checkVersion(){
        UIUtils.showToastSafe("已是最新版本");
    }

    @OnClick(R.id.rl_privacy)
    public void privacy(){
        intent(PrivacyActivity.class);
    }

    @Override
    protected void destoryData() {

    }
}
